import joblib
import numpy as np
import cv2  # 需要安装：pip install opencv-python
model = joblib.load("../../hexinwenjianbao/text_classifier.pkl")
vectorizer = joblib.load("../../hexinwenjianbao/tfidf_vectorizer.pkl")

# 示例文本
input_text = "京剧"  # 假设这是你的输入

# 将文本转换为数字
X_test = vectorizer.transform([input_text])  # 注意：将字符串包装成列表

# 预测类别和置信度
predicted_labels = model.predict(X_test)  # 预测类别
predicted_probas = model.predict_proba(X_test)  # 预测概率（置信度）
print(model.classes_)
print("预测类别:", predicted_labels)
print("预测概率:", predicted_probas)
